package com.swh.controller.business;

import com.github.pagehelper.PageInfo;
import com.swh.entity.QualificationCondition;
import com.swh.service.WorkOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * @Author: swh
 * @Description:
 * @Date: 2020/12/14 14:41
 * @Version: 1.0
 */
@Controller
@RequestMapping("/guguanjia/admin/work")
public class WorkOrderController {

    @Autowired
    private WorkOrderService workOrderService;

    @RequestMapping("/index")
    public String login() {
        return "work/admin/work";
    }

    @ResponseBody
    @RequestMapping("/findAll/{pageNum}/{pageSize}")
    public PageInfo<Map> findAll(@PathVariable("pageNum") int pageNum, @PathVariable("pageSize") int pageSize,
                                 QualificationCondition condition) {
        return workOrderService.selectPage(pageNum, pageSize,condition);
    }


    @RequestMapping("/toUpdate")
    public String tuUpdate() {
        return "work/work_detail";
    }


    @ResponseBody
    @RequestMapping("/selectById")
    public Map<String,Object> findByOrder( Integer id){
        return workOrderService.findByOrder(id);
    }



}
